package com.quectel.sdk.pay;

import cn.hutool.core.util.XmlUtil;
import com.quectel.util.common.JacksonUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * 支付回调的相关相应
 *
 * @author: caolu
 * @email: louis.cao@quectel.com
 * @date: 2023-04-13 14:02:00
 */
public class PayNotifyResponse {
    /**
     * 支付宝处理成功响应
     *
     * @return
     */
    public static String aliPayHandSuccessStr() {
        return "SUCCESS";
    }

    /**
     * 支付宝处理失败响应
     *
     * @return
     */
    public static String aliPayHandFailedStr() {
        return "FAIL";
    }


    /**
     * 微信支付V2处理成功响应
     *
     * @return
     */
    public static String wechatPayV2HandSuccessStr() {
        Map<String, String> respMap = new HashMap<>();
        respMap.put("return_code", "SUCCESS");
        respMap.put("return_msg", "OK");
        return XmlUtil.mapToXmlStr(respMap);
    }


    /**
     * 微信支付V2处理失败响应
     *
     * @return
     */
    public static String wechatPayV2HandFailedStr() {
        Map<String, String> respMap = new HashMap<>();
        respMap.put("return_code", "FAIL");
        respMap.put("return_msg", "FAIL");
        return XmlUtil.mapToXmlStr(respMap);
    }

    /**
     * 微信支付V3处理成功响应
     *
     * @return
     */
    public static String wechatPayV3HandSuccessStr() {
        Map<String, String> respMap = new HashMap<>();
        respMap.put("code", "SUCCESS");
        respMap.put("message", "SUCCESS");
        return JacksonUtils.toJsonString(respMap);
    }


    /**
     * 微信支付V3处理失败响应
     *
     * @return
     */
    public static String wechatPayV3HandFailedStr() {
        Map<String, String> respMap = new HashMap<>();
        respMap.put("code", "FAIL");
        respMap.put("message", "FAIL");
        return JacksonUtils.toJsonString(respMap);
    }

}
